
package com.bstek.urule.parse.deserializer;

import com.bstek.urule.model.scorecard.ScorecardDefinition;
import com.bstek.urule.parse.scorecard.ScorecardParser;
import org.dom4j.Element;

/**
 * @author Jacky.gao
 * @since 2016年9月22日
 */
public class ScorecardDeserializer implements Deserializer<ScorecardDefinition> {
    public static final String BEAN_ID = "urule.scorecardDeserializer";
    private ScorecardParser scorecardParser;

    @Override
    public ScorecardDefinition deserialize(Element root) {
        ScorecardDefinition card = scorecardParser.parse(root);
        return card;
    }

    public void setScorecardParser(ScorecardParser scorecardParser) {
        this.scorecardParser = scorecardParser;
    }

    @Override
    public boolean support(Element root) {
        return scorecardParser.support(root.getName());
    }
}
